package com.eee.xiang.market.common;

public class OperateResponse<T> {
    public final static String OK = "操作成功";
    private ResponseResult status;
    private String message;
    private T data;

    public OperateResponse(){super();}//所有的类都是继承Object所以super()所以;

    public OperateResponse(ResponseResult status, String message, T data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public static <T> OperateResponse obtainSuccessResponse(T data) {
        return new OperateResponse<>(ResponseResult.SUCCESS, OK, data);
    }

    public static OperateResponse failResponse(String message){
        return new OperateResponse(ResponseResult.BUSINESSDATAERROR, message, null);
    }

    public static OperateResponse failResponse(ResponseResult status, String message){
        return new OperateResponse(status, message, null);
    }


    public ResponseResult getStatus() {
        return status;
    }

    public void setStatus(ResponseResult status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
